<div>
    <fieldset>
        <legend>Возврат</legend>

        <input type="hidden" id="issue_id" value="<?php echo $this->data['issue_id']; ?>"/>
        <input type="hidden" id="item_id" value="<?php echo $this->data['item_id']; ?>"/>

        <span class="ErrorMessage" id="ErrMsg"></span>

        <table><tbody>
            <tr><td>Дата возврата:</td><td><input type="text" id="ret_date"
                value="<?php echo date('d.m.Y', time()); ?>"/></td></tr>
        </tbody></table>
    </fieldset>

    <div class="ControlPanel">
        <button id="ReturnItem">OK</button>
        <button id="CancelReturn">Отмена</button>
    </div>

    <script type="text/javascript">
        jsun.run(function() {
        //////////////////////////////////////////////////////

        jsun('#ReturnItem').jsun.event({ onclick: ReturnItem});
        jsun('#CancelReturn').jsun.event({ onclick: CloseDialog });

        function ReturnItem() {
            var param = 'u=Edition/ReturnItem' + jsun.page.get_data();

            jsun.json.load(function(p){
                if (p.STAT != 'ERR') {

                    jsun.json.load(function(p) {
                        var div = jsun('#ReaderIssues');
                        div.innerHTML = "";
                        div.appendChild(jsun.dom.from_json(p));
                    }, 'u=Lib&m=Lib\\Reader/IssueList&user_id=' + jsun('#ReaderId').value);

                    CloseDialog();
                } else {
                    ShowError();
                }
            }, param);
        }

        function CloseDialog() {
            jsun.dialog.active.close();
        }

        function ShowError() {
        jsun('#ErrMsg').innerHTML
            = '<ul><li>Ошибка при выполнениее операции</li></ul>';
    }

        //////////////////////////////////////////////////////
        });
    </script>
</div>